import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase = "DBshop017_添加属性组"

# 调用函数 实例化浏览器对象 打开指定网址
driver = openBrowser(urlAdmin)
# 调用函数登录后台
DBshopLoginAdmin(driver)
# 处理三级菜单
DBshopEnterMenu3(driver,'商品管理','商品属性','属性分组')
# 点击添加
driver.find_element_by_partial_link_text("添加属性组").click()
# 输入内容
driver.find_element_by_id("attribute_group_name").send_keys(shuxing)
# 清空输入框
driver.find_element_by_id("attribute_group_sort").clear()
# 重新输入
driver.find_element_by_id("attribute_group_sort").send_keys("1")
# 点击保存
driver.find_element_by_xpath("//button").click()
# 取页面的数据
shuxing = driver.find_element_by_xpath("//tbody/tr[1]/td[2]").text

# 断言
if shuxing == shuxing:
    writeLog("%s 测试通过" % (testCase))
else:
    writeLog("%s 测试失败" % (testCase))
    getPhoto(driver)
driver.quit()
